package com.hazardSoft.eStore.entities;

import java.io.Serializable;
import java.sql.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Transient;

import com.hazardSoft.eStore.utils.QueryConstants;

@Entity
@NamedQueries({
	@NamedQuery(name = QueryConstants.QUERY_LIST_BILLS_BY_SELLER, query = "FROM Bill bl WHERE bl.seller=?1")
})
public class Bill implements Serializable {
	@Id
	@GeneratedValue
	private int id;

	private Date date;

	private double total;

	@ManyToOne
	@JoinColumn(name="seller")
	private User seller;

	@ManyToOne
	@JoinColumn(name="client")
	private User client;

//	@OneToMany(mappedBy="check")
	@Transient
	private List<Sale> saleCollection;
	
	private String address;

	private static final long serialVersionUID = 1L;

	public Bill() {
		super();
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public double getTotal() {
		return this.total;
	}

	public void setTotal(double total) {
		this.total = total;
	}

	public User getSeller() {
		return this.seller;
	}

	public void setSeller(User seller) {
		this.seller = seller;
	}

	public User getClient() {
		return this.client;
	}

	public void setClient(User client) {
		this.client = client;
	}

	public List<Sale> getSaleCollection() {
		return this.saleCollection;
	}

	public void setSaleCollection(List<Sale> saleCollection) {
		this.saleCollection = saleCollection;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

}
